<?php include '../public/header.php' ?>
<link rel='stylesheet' href='/static/admin/css/welcome.css'>
<body class="laytp-container" >
<div id="welcome" style="padding: 15px;padding-bottom: 30px">
    <div class="leftkuai">
        <div class="huanhuan">
            <img src="/static/admin/images/huanhuan.jpg" class="huanhuandi">
            <img src="/static/admin/images/ddtou.png" class="ddtou" id="user_avatar">
            <div class="ddwen1"><span class="top_realname"><span id="realname"></span> 您好！</span>  <span>欢迎登录筑为智慧经营管理系统！</span></div>
            <div class="ddwen2"><span>登录于：<span id="lastoptdt"></span></span></div>
        </div>
    </div>
    <div class="rightkuai" style="position: relative">
        <img src="/static/admin/images/youyou.png" class="welyouyoudi">
        <img src="/static/admin/images/youyouda.png" class="welyouyouda">
    </div>



    <div class="leftkuai" style="height: 375px">
        <div class="contit"><span class="titname">我的流程</span></div>
        <div class="liu1">
            <div class="kuang">
                <div class="kkk kkkone">
                    <div class="kkklll"><img src="/static/admin/images/kklan.png" class="kktuone"></div>
                    <div class="kkkrrr"><div class="cc1">我发起的</div><div class="cc22" id="bill_create" onclick="bill_create(this)">0</div></div>
                </div>
                <div class="kkk">
                    <div class="kkklll"><img src="/static/admin/images/kkhuang.png" class="kktu"></div>
                    <div class="kkkrrr"><div class="cc1">审核中</div><div class="cc2" id="bill_hand" onclick="bill_hand(this)">0</div></div>
                </div>
                <div class="kkk">
                    <div class="kkklll"><img src="/static/admin/images/kkhuang.png" class="kktu"></div>
                    <div class="kkkrrr"><div class="cc1">已审核</div><div class="cc2" id="bill_finish" onclick="bill_finish(this)">0</div></div>
                </div>
                <div class="kkk">
                    <div class="kkklll"><img src="/static/admin/images/kkhuang.png" class="kktu"></div>
                    <div class="kkkrrr"><div class="cc1">草稿</div><div class="cc2" id="bill_turn" onclick="bill_turn(this)">0</div></div>
                </div>
            </div>
            <div class="clear"></div>
            <div class="minbb">
                <div id="flowinfo"></div>
            </div>
        </div>
        <div class="liu2">
            <div class="kkxian">
                <img src="/static/admin/images/kkadd.png" class="kktu" onclick="more_add_bill(this)">
            </div>
        </div>
    </div>
    <div class="rightkuai" style="height:100px">
        <div class="xiao">
            <div class="mm2" onclick="more_yujing(this)">
                <div id="carouselyujing" class="layui-carousel carouselyang"  lay-filter="carouselyujing">
                    <div carousel-item id="yujinginfo"></div>
                </div>
            </div>
            <div class="mm3" onclick="more_yujing(this)">
                <img src="/static/admin/images/yujing.png" class="mmtu">
                <div class="mmtt">预警消息</div>
            </div>
        </div>
        <div class="clear"></div>
    </div>
    <div class="rightkuai" style="height:100px">
        <div class="xiao">
            <div class="mm2" onclick="more_meet(this)">
                <div id="carouselmeet" class="layui-carousel carouselyang"  lay-filter="carouselmeet">
                    <div carousel-item id="meetinfo"></div>
                </div>
            </div>
            <div class="mm3" onclick="more_meet(this)">
                <img src="/static/admin/images/jinrihuiyi.png" class="mmtu">
                <div class="mmtt">今日会议</div>
            </div>
        </div>
    </div>
    <div class="rightkuai" style="height:430px">
        <div class="contit"><span class="titname">通知公告</span><span class="titmore" onclick="more_notice(this)">更多 ></span></div>
        <div class="kuainei">
            <div class="con tongzhi" id="noticeinfo">
                <div class="nodata"><img src="/static/admin/images/que.png" alt=""></div>
            </div>
        </div>
    </div>


    <div class="leftkuai" style="height: 265px;width:calc(40% - 10px);">
        <div class="contit"><span class="titname">我的审批</span></div>
        <div class="liushen">
            <div class="kuang">
                <div class="kkk kkkone">
                    <div class="kkklll"><img src="/static/admin/images/kklan.png" class="kktuone"></div>
                    <div class="kkkrrr"><div class="cc1">待我审批</div><div class="cc22" id="flow_hand" onclick="flow_hand(this)">0</div></div>
                </div>
                <div class="kkk">
                    <div class="kkklll"><img src="/static/admin/images/kkhuang.png" class="kktu"></div>
                    <div class="kkkrrr"><div class="cc1">我已审批</div><div class="cc2" id="flow_finish" onclick="flow_finish(this)">0</div></div>
                </div>
                <div class="kkk">
                    <div class="kkklll"><img src="/static/admin/images/kkhuang.png" class="kktu"></div>
                    <div class="kkkrrr"><div class="cc1">抄送我</div><div class="cc2" id="flow_promer" onclick="flow_promer(this)">0</div></div>
                </div>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <div class="leftkuai" style="height: 265px;width:calc(30% - 10px);margin-left: 10px">
        <div class="contit"><span class="titname">工作汇报</span><span class="titmore" onclick="more_hui(this)">更多 ></span></div>
        <div class="kuainei">
            <div class="con huibao" id="huiinfo">
                <div class="nodata"><img src="/static/admin/images/que.png" alt=""></div>
            </div>
        </div>
    </div>

    <div class="clear"></div>
</div>

<script>

    layui.use(['laytp', 'form','carousel'], function() {
        var form = layui.form, layer = layui.layer, carousel = layui.carousel;
        func_get_shen();
        func_get_notice();
        func_get_jinflow();

        function func_get_shen(){
            facade.ajax({url: ask_wel_get_shen,showLoading:false}).done(function(res){
                if (res.code === 2000) {
                    var data = res.data;

                    if(data.avatar){
                        $("#user_avatar").attr('src',get_file_complete(data.avatar));
                    }
                    $("#realname").html(data.realname);
                    $("#lastoptdt").html(data.lastoptdt);

                    $("#bill_create").html(data.bill_create);
                    $("#bill_hand").html(data.bill_hand);
                    $("#bill_finish").html(data.bill_finish);
                    $("#bill_turn").html(data.bill_turn);

                    $("#flow_hand").html(data.flow_hand);
                    $("#flow_finish").html(data.flow_finish);
                    $("#flow_promer").html(data.flow_promer);
                }
            });
        }
        function func_get_notice(){
            facade.ajax({url: ask_wel_get_notice,showLoading:false}).done(function(res){
                if (res.code === 2000) {


                    var yujing = res.data.yujing;
                    if(yujing.length > 0){
                        var yujingstr = '';
                        for (var lunKey in yujing){
                            yujingstr += '<div> '+(parseInt(lunKey)+1)+'、'+yujing[lunKey].mess+'</div>';
                        }
                        $("#yujinginfo").html(yujingstr);
                    }else{
                        $("#yujinginfo").html('<div class="zanwu">暂无消息</div>');
                    }
                    var carouselyujing = carousel.render({
                        elem: '#carouselyujing'
                        ,arrow:'none'
                        ,width: $("#yujinginfo").width()+'px'
                        ,height: $("#yujinginfo").height()+'px'
                    });

                    var meet = res.data.meet;
                    if(meet.length > 0){
                        var meetstr = '';
                        for (var lunKey in meet){
                            meetstr += '<div> '+(parseInt(lunKey)+1)+'、'+meet[lunKey].title+'</div>';
                        }
                        $("#meetinfo").html(meetstr);
                    }else{
                        $("#meetinfo").html('<div class="zanwu">暂无消息</div>');
                    }
                    var carouselmeet = carousel.render({
                        elem: '#carouselmeet'
                        ,arrow:'none'
                        ,width: $("#meetinfo").width()+'px'
                        ,height: $("#meetinfo").height()+'px'
                    });







                    var notice = res.data.notice;
                    if(notice.length > 0){
                        var noticestr = '';
                        for (var key in notice){
                            noticestr += '<div class="li" onclick="show_notice('+notice[key].id+', this)">';
                            noticestr += '<div class="zhu float-l">';
                            noticestr += '<span class="colorlan">['+notice[key].tongtype+']</span>';
                            noticestr += '<span> '+notice[key].title+'</span>';
                            noticestr += '</div>';
                            noticestr += '<div class="jin float-r">'+notice[key].created_at+'</div>';
                            noticestr += '</div>';
                        }
                        $("#noticeinfo .li").remove();
                        $("#noticeinfo .nodata").hide();
                        $("#noticeinfo").append(noticestr);
                    }else{
                        $("#noticeinfo .li").remove();
                        $("#noticeinfo .nodata").show();
                    }





                    var hui = res.data.hui;
                    if(hui.length > 0){
                        var huistr = '';
                        for (var key in hui){
                            huistr += '<div class="li" onclick="show_hui('+hui[key].id+', this)">';
                            huistr += '<div class="zhu float-l">';
                            huistr += '<span class="colorlan"> ['+hui[key].read+']</span>';
                            huistr += '<span> '+hui[key].title+'</span>';
                            huistr += '</div>';
                            huistr += '<div class="jin float-r">';
                            huistr += '<span> '+hui[key].created_at+'</span>';
                            huistr += '<span> '+hui[key].created_user_name+'</span>';
                            huistr += '</div>';
                            huistr += '</div>';
                        }
                        $("#huiinfo .li").remove();
                        $("#huiinfo .nodata").hide();
                        $("#huiinfo").append(huistr);
                    }else{
                        $("#huiinfo .li").remove();
                        $("#huiinfo .clear").remove();
                        $("#huiinfo .nodata").show();
                    }

                }
            });
        }
        function func_get_jinflow(){
            facade.ajax({url: ask_wel_get_jinflow,showLoading:false}).done(function(res){
                if (res.code === 2000) {
                    var data = res.data;

                    var mystr = '';
                    for (var key in data){
                        mystr += '<div class="mm">';
                        mystr += '<div class="ff" onclick="show_jindu(\''+data[key].modenum+'\',\''+data[key].ispublish+'\',\''+data[key].status+'\')">';
                        mystr += '<img src="/static/admin/images/flow/'+data[key].modenum+'.png" class="mmtu">';
                        mystr += '<span class="ffname">'+data[key].modename+'</span>';
                        mystr += '</div>';
                        mystr += '</div>';
                    }
                    $("#flowinfo").html(mystr);
                }
            });
        }




    });










    function more_notice(obj) {
        $(obj).addClass('butmoreck');
        openNavPage('通知公告','noticemy/index.php')
    }
    function show_notice(id, obj) {
        $(obj).addClass('butmoreck');
        openPage('../notice/show.php?id='+id);
    }

    function more_hui(obj) {
        $(obj).addClass('butmoreck');
        openNavPage('汇报给我','huimy/index.php')
    }
    function show_hui(id, obj) {
        $(obj).addClass('butmoreck');
        openPage('../hui/show.php?id='+id);
    }

    function more_yujing(obj) {
        openNavPage('预警消息','todo/index.php?xiaolei=2&status=0')
    }
    function more_meet(obj) {
        openNavPage('会议信息','meetmy/index.php')
    }


    function show_jindu (modenum, ispublish, status){
        if(status < 1){
            facade.error("该模块已禁用，请联系管理员启用"); return false;
        }
        if(ispublish != 'true'){
            facade.error("该模块未发布流程，请联系管理员发布审核流程"); return false;
        }
        openPage('../'+modenum+'/flow_add.php?close=1');
    }
    function more_add_bill(obj) {
        $(obj).addClass('butmoreck');
        openPageRight('../public_flow/flow_bill_add.php');
    }



    function bill_create(obj) {
        $(obj).addClass('butmoreck');
        openNavPage('我发起的','bill_create/index.php')
    }
    function bill_hand(obj) {
        $(obj).addClass('butmoreck');
        openNavPage('审核中的','bill_hand/index.php')
    }
    function bill_finish(obj) {
        $(obj).addClass('butmoreck');
        openNavPage('已审核的','bill_finish/index.php')
    }
    function bill_turn(obj) {
        $(obj).addClass('butmoreck');
        openNavPage('草稿','bill_turn/index.php')
    }


    function flow_hand(obj) {
        $(obj).addClass('butmoreck');
        openNavPage('待我审批','flow_hand/index.php')
    }
    function flow_finish(obj) {
        $(obj).addClass('butmoreck');
        openNavPage('我已审批','flow_finish/index.php')
    }
    function flow_promer(obj) {
        $(obj).addClass('butmoreck');
        openNavPage('抄送我','flow_promer/index.php')
    }






</script>
</body>
</html>
